/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 * @Package com.apache.attachment.client  
 */
package com.apache.client;

import java.util.HashMap;
import java.util.Map;

import com.apache.api.vo.ResultEntity;
import com.apache.attachment.mommon.ToolsUtil;

/**
 * description:  
 * @author mhguo 创建时间：2015-10-15  
 * @Copyright(c)2014:北京--软件技术有限公司
 */
public class AttaCoreClient {

	public static ResultEntity getAttachmentList(String objId, String objType) {
		ResultEntity root = null;

		if (ToolsUtil.isNull(objId) || ToolsUtil.isNull(objType)) {
			root = new ResultEntity();
			root.setResult("false");
			root.setMessage("参数不能为空");
		} else {
			Map<String, Object> dataMap = new HashMap<String, Object>();
			dataMap.put("objId", objId);
			dataMap.put("objType", objType);
			root = AttaProtocolClient.getInstance().doService("attachmentService", "attalist", dataMap);
		}

		return root;
	}

	public static ResultEntity delAttaById(String id) {
		ResultEntity root = null;

		if (ToolsUtil.isNull(id)) {
			root = new ResultEntity();
			root.setResult("false");
			root.setMessage("参数不能为空");
		} else {
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("id", id);
			root = AttaProtocolClient.getInstance().doService("attachmentService", "delAttaById", params);
		}

		return root;
	}

	public static ResultEntity delAttaByObjId(String objType, String objId) {
		ResultEntity root = null;

		if (ToolsUtil.isNull(objType) || ToolsUtil.isNull(objId)) {
			root = new ResultEntity();
			root.setResult("false");
			root.setMessage("参数不能为空");
		} else {
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("objType", objType);
			params.put("objId", objId);
			root = AttaProtocolClient.getInstance().doService("attachmentService", "delAttaByObjId", params);
		}

		return root;
	}
}
